package com.yami.shop.dao;

import com.yami.shop.bean.model.UserRecommendation;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
/**
 * @author DELL
 */
@Mapper
public interface UserRecommendationMapper {
    /**
     * 插入或更新推荐结果
     * @param recommendation
     */

    @Insert("INSERT INTO user_recommendation (user_id, recommended_items, update_time) " +
            "VALUES (#{userId}, #{recommendedItems}, #{updateTime}) " +
            "ON DUPLICATE KEY UPDATE recommended_items = VALUES(recommended_items), update_time = VALUES(update_time)")
    void insertOrUpdate(UserRecommendation recommendation);
}
